package game.util;

import java.util.Random;

public class Die 
{
	private int sides;
	private int quantity;

	public Die(int sides, int quantity) {
		super();
		this.sides = sides;
		this.quantity = quantity;
	}
	
	public int roll()
	{
		int result = 0;
		Random generator = new Random();
		for (int i = quantity; i > 0; i--)
		{
			result = result + 1 + generator.nextInt(sides);
		}		
		return result;
	}

	public static int roll(int sides, int quantity)
	{
		int result = 0;
		Random generator = new Random();
		for (int i = quantity; i > 0; i--)
		{
			result = result + 1 + generator.nextInt(sides);
		}		
		return result;
	}
}
